From 0d6c9a9b2c171218a661d4b70c0c662d85622cfb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 9 Jul 2017 13:10:24 +0300 Subject: [PATCH] Merge duplicate tests --- tests/bad-config.rs | 49 +++++++++++++++++++++++++++++++++++++++-- tests/build.rs | 53 --------------------------------------------- 2 files changed, 47 insertions(+), 55 deletions(-) diff --git a/tests/bad-config.rs b/tests/bad-config.rs index d18d14007..cff576dbb 100644 --- a/tests/bad-config.rs +++ b/tests/bad-config.rs @@ -610,7 +610,7 @@ have a single canonical source path irrespective of build target. #[test] fn unused_keys() { - let foo = project("foo") + let p = project("foo") .file("Cargo.toml", r#" [package] name = "foo" @@ -622,14 +622,59 @@ fn unused_keys() { "#) .file("src/lib.rs", ""); - assert_that(foo.cargo_process("build"), + assert_that(p.cargo_process("build"), execs().with_status(0).with_stderr("\ warning: unused manifest key: target.foo.bar [COMPILING] foo v0.1.0 (file:///[..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +")); + + let mut p = project("foo"); + p = p + .file("Cargo.toml", r#" + [project] + + name = "foo" + version = "0.5.0" + authors = ["wycats@example.com"] + bulid = "foo" + "#) + .file("src/lib.rs", r#" + pub fn foo() {} + "#); + assert_that(p.cargo_process("build"), + execs().with_status(0) + .with_stderr("\ +warning: unused manifest key: project.bulid +[COMPILING] foo [..] +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +")); + + let mut p = project("bar"); + p = p + .file("Cargo.toml", r#" + [project] + + name = "foo" + version = "0.5.0" + authors = ["wycats@example.com"] + + [lib] + build = "foo" + "#) + .file("src/lib.rs", r#" + pub fn foo() {} + "#); + assert_that(p.cargo_process("build"), + execs().with_status(0) + .with_stderr("\ +warning: unused manifest key: lib.build +[COMPILING] foo [..] +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ")); } + #[test] fn empty_dependencies() { let p = project("empty_deps") diff --git a/tests/build.rs b/tests/build.rs index 9c97323a3..9dfbbe7c3 100644 --- a/tests/build.rs +++ b/tests/build.rs @@ -1046,59 +1046,6 @@ fn many_crate_types_correct() { assert_that(&p.root().join("target/debug").join(&fname), existing_file()); } -#[test] -fn unused_keys() { - let mut p = project("foo"); - p = p - .file("Cargo.toml", r#" - [project] - - name = "foo" - version = "0.5.0" - authors = ["wycats@example.com"] - bulid = "foo" - - [lib] - name = "foo" - path = "foo" - "#) - .file("src/foo.rs", r#" - pub fn foo() {} - "#); - assert_that(p.cargo_process("build"), - execs().with_status(0) - .with_stderr("\ -warning: unused manifest key: project.bulid -[COMPILING] foo [..] -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -")); - - let mut p = project("bar"); - p = p - .file("Cargo.toml", r#" - [project] - - name = "foo" - version = "0.5.0" - authors = ["wycats@example.com"] - - [lib] - - name = "foo" - build = "foo" - "#) - .file("src/foo.rs", r#" - pub fn foo() {} - "#); - assert_that(p.cargo_process("build"), - execs().with_status(0) - .with_stderr("\ -warning: unused manifest key: lib.build -[COMPILING] foo [..] -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -")); -} - #[test] fn self_dependency() { let mut p = project("foo"); -- 2.30.2